package com.spa.interfaces.member;

import cn.dev33.satoken.annotation.SaIgnore;
import com.spa.application.dto.PageResult;
import com.spa.application.dto.member.MemberServiceDTO;
import com.spa.application.query.member.MemberServiceDetailsQuery;
import com.spa.application.query.member.MemberServiceQuery;
import com.spa.application.service.member.MemberServiceApplicationService;
import com.spa.infrastructure.common.ResponseMessage;
import com.spa.interfaces.BaseController;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("member/service")
public class MemberServiceController extends BaseController {

    @Resource
    private MemberServiceApplicationService memberServiceApplicationService;

    /**
     * 首页全部项目
     * @param query
     * @return
     */
    @PostMapping("/page")
    @SaIgnore
    public ResponseMessage<PageResult<MemberServiceDTO>> page(@RequestBody MemberServiceQuery query) {
        return responseHelper.success(memberServiceApplicationService.page(query));
    }

    /**
     * 项目详情（二级页面）
     * @param query
     * @return
     */
    @PostMapping("/details")
    @SaIgnore
    public ResponseMessage<MemberServiceDTO> details(@Validated @RequestBody MemberServiceDetailsQuery query) {
        return responseHelper.success(memberServiceApplicationService.details(query));
    }

}
